package com.ynet.middleground.mobile.approve.commom;

import java.io.Serializable;

import com.ynet.core.common.PagerInfo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @ClassName ResponseResult
 * @Description 移动审批返回对象
 * @Author liwq
 * @Date 2021/3/22 11:09
 * @Version 1.0
 */
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Data
@ApiModel(value = "响应信息")
public class ResponseResult<T> implements Serializable {

    private static final long serialVersionUID = 6111869209492648909L;

    @ApiModelProperty(value = "响应结果")
    private T data;

    @ApiModelProperty(value = "分页信息")
    private PagerInfo pageInfo;

    @ApiModelProperty(value = "是否成功")
    private boolean success = true;

    @ApiModelProperty(value = "错误信息")
    private String errorMsg = "";

    @ApiModelProperty(value = "错误码")
    private String errorCode = "0";

    public ResponseResult() {}

    public ResponseResult(String errorCode, String errorMsg) {
        this.errorMsg = errorMsg;
        this.errorCode = errorCode;
        this.success = false;
    }

    public void setError(String code, String message) {
        this.errorCode = code;
        this.errorMsg = message;
        this.success = false;
    }

}
